package com.day21.Tcp;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

class clientDemo {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("192.168.1.66", 10000);
        OutputStream os = s.getOutputStream();
        os.write("hello,tcp,我来了".getBytes());
        InputStream is = s.getInputStream();
        byte[] bys = new byte[1024];
        int len = is.read(bys);
        String data = new String(bys, 0, len);
        System.out.println("客户端：" + data);
        s.close();
    }
}
